-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Migrate Post Template Delete button from confirm()
to ConfirmDialog
#37535
Migrate Post Template Delete button from confirm()
to ConfirmDialog
#37535
Conversation
faf8885
to
cf8b058
Compare
Updated this PR to simplify the implementation of ConfirmDialog (cc @ciampo) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @chad1008 , thank you for working on this!
I noticed that the dropdown with the "Delete template" button sits on top of the confirm dialog. This happens at all screen sizes, but it can be more easily spotted on smaller viewports:
Otherwise, my feedback is basically the same as the one I left in PR 37491, including the consideration about unit/e2e tests.
packages/edit-post/src/components/header/template-title/delete-template.js
Show resolved
Hide resolved
packages/edit-post/src/components/header/template-title/delete-template.js
Show resolved
Hide resolved
packages/edit-post/src/components/header/template-title/delete-template.js
Outdated
Show resolved
Hide resolved
@ciampo Well spotted. It turned out this was due to the current z-index settings for Until that PR is merged, and this one is rebased, we should cherrypick that one into any further |
Update:
Thank you for looking into the problem and opening #37959. Unfortunately I'm afraid that the fix may need to be more complicated than bumping the We'll likely have to wait until this issue is fixed before being able to merge this PR |
4dcd72d
to
6b40d98
Compare
I've added some new e2e tests for both the The tests work well for me locally, apart from a couple of oddities I'll comment on inline |
await trashAllPosts( 'wp_template' ); | ||
await trashAllPosts( 'wp_template_part' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've included these calls because I see they're common to a number of other template-related tests, but when the actual test runs they don't actually trash anything. The URLs this utility points to for templates and template-parts just load a WP permissions error.
I'm not sure yet if these are in place for a planned future UI or if they're artifacts of something that was removed/never implemented.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
My gut feeling is that these functions may be useful as a "reset" in case multiple e2e tests were to run on the same instance (although I'm not sure about it)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's how it seems to me as well, it was just odd that they point to wp-admin pages that don't seem to exist/can't be accessed by an Admin. Hopefully the fix @talldan mentions below will make them operational, as cleanup of existing templates would be awesome!
await closeDocumentSettingsButton.click(); | ||
} | ||
await insertBlock( 'Paragraph' ); | ||
await page.keyboard.type( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous test in the suite leaves the site on Twenty Twenty-one, which works well for the tests I've added. I did notice, however that switching to another theme (tested Twenty Twenty-two and Emptytheme) causes the new tests to fail (see line 206 for the e2e-util that handles the theme switch)
On either of those two themes, and potentially others, this call to page.keyboard.type
isn't able to complete. It stops midway through the string for reasons I can't see and the test ends up failing.
The new tests were flagged as flaky:
I'm not sure if that's related to the permissions error you noticed. There's an incoming fix for that permissions error in #38524. |
Hey @chad1008 , unfortunately I'm not familiar with the issues that you're facing in the e2e tests — @talldan , do you know who could we ask for help on this one?
Thank you for letting us know, hopefully merging #38524 will help with the test flakiness. |
2eca5e6
to
4f74617
Compare
Rebasing this branch to incorporate the template deletion updates did eliminate those permissions errors, but it didn't do much that I could tell for the flakiness. I have since dug in a bit more and made some improvements. All tests in this suite are now passing consistently for me now, but happy to revisit if more flakiness surfaces! @talldan is there a method I can use to retrigger the checks that originally flagged these tests as flaky? |
Hey @chad1008, can we consider the flakiness of the tests fixed? Asking just because I lost track with all the parallel e2e work that happened in the last week, and wasn't sure if any of that contributed to fix this PR's e2e flakiness 😅 |
@ciampo I hope so! Between the improvements I made last week and possibly coinciding changes elsewhere that may have helped, these tests pass consistently for me locally (I can run them at least 25 times in a row with no issues). I'm no sure if we can rerun the checks that @talldan mentioned previously, or if they automatically rerun when we add new commits, but as long as there are no other indicators like those that these tests are still a problem, I think the flakiness has been resolved 🤞 |
@chad1008, let's rebased and confirm all checks are green on Github + check for new logs in the issue of the flaky tests. If we're clean on those fronts, I think flaky tests were resolved for this PR. |
4f74617
to
415ef76
Compare
All CI checks passed successfully, and I didn't spot any new "Flaky Test" issue regarding this PR. @Mamaduka , do you know if we should wait a bit longer to see if any tests are going to be flagged as flaky (or if I didn't check in the right place 😅 )? Otherwise I assume we're good to go! |
I think we're good to merge 👍 The only issue that got updated after rebase is #35502, and this test is known to be flaky. |
Thank you both! |
Related: #34153
Description
This PR aims to migrate the FSE post template editor's
Delete template
menu item away from the currentconfirm()
implementation and instead use the new experimentalConfirmDialog
component.How has this been tested?
Before testing, cherrypick #37959 on top of this PR. That will ensure the
ConfirmDialog
has the proper z-index to render on top of its parent component.Running WordPress 5.8.2 via
wp-env
:I've tested in the latest Chrome, Firefox, and Safari.
Checklist:
*.native.js
files for terms that need renaming or removal).